<template>
  <div>
    <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="编码" prop="projectName">
            <el-input v-model="form.projectName" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="助记符" prop="projectName">
            <el-input v-model="form.projectName" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="名称" prop="projectName">
            <el-input v-model="form.projectName" placeholder="请输入" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="类型" prop="projectName">
            <el-select v-model="form.projectName" placeholder="请选择">
              <el-option
                v-for="dict in [
                  {
                    value: 1,
                    label: '字符',
                  },
                  {
                    value: 1,
                    label: '字符',
                  },
                ]"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="状态" prop="projectName">
            <el-select v-model="form.projectName" placeholder="请选择">
              <el-option
                v-for="dict in [
                  {
                    value: 1,
                    label: '正常',
                  },
                  {
                    value: 1,
                    label: '不正常',
                  },
                ]"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="顺序" prop="description">
            <el-input v-model="form.description" placeholder="请输入" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="外接编码" prop="description">
            <el-input v-model="form.description" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="外接名称" prop="description">
            <el-input v-model="form.description" placeholder="请输入" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="备注" prop="price">
            <el-input
              v-model="form.price"
              type="textarea"
              placeholder="请输入"
              show-word-limit
              maxlength="200"
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <el-form-item label="检查地点" prop="description">
            <el-input v-model="form.description" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="报告模板" prop="description">
            <el-input v-model="form.description" placeholder="请输入" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="启用结论库" prop="description">
            <el-select v-model="form.projectName" placeholder="请选择">
              <el-option
                v-for="dict in [
                  {
                    value: 1,
                    label: '正常',
                  },
                  {
                    value: 1,
                    label: '不正常',
                  },
                ]"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "EditForm",
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 检查项目表格数据
      list: [
        {
          num: 0,
        },
      ],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  methods: {
    /** 查询检查项目列表 */
    getList() {
      this.loading = true;
      // listProject(this.queryParams).then((response) => {
      //   this.projectList = response.rows
      //   this.total = response.total
      //   this.loading = false
      // })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        categoryId: null,
        projectName: null,
        price: null,
        description: null,
        sexLimit: 2,
        ageLimit: null,
        address: null,
        isDel: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
      };
      // this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "新增";
    },
    /** 编辑按钮操作 */
    handleUpdate(row) {
      this.reset();
      // const id = row.id || this.ids
      // getProject(id).then((response) => {
      //   this.form = response.data
      //   this.open = true
      //   this.title = '编辑'
      // })
    },
    /** 提交按钮 */
    submitForm() {
      // this.$refs['form'].validate((valid) => {
      //   if (valid) {
      //     if (this.form.id != null) {
      //       updateProject(this.form).then((response) => {
      //         this.$modal.msgSuccess('编辑成功')
      //         this.open = false
      //         this.getList()
      //       })
      //     } else {
      //       addProject(this.form).then((response) => {
      //         this.$modal.msgSuccess('新增成功')
      //         this.open = false
      //         this.getList()
      //       })
      //     }
      //   }
      // })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      // const ids = row.id || this.ids
      // this.$modal
      //   .confirm('是否确认删除？')
      //   .then(function() {
      //     return delProject(ids)
      //   })
      //   .then(() => {
      //     this.getList()
      //     this.$modal.msgSuccess('删除成功')
      //   })
      //   .catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "tijianyuyue/project/export",
        {
          ...this.queryParams,
        },
        `project_${new Date().getTime()}.xlsx`
      );
    },
  },
};
</script>

<style>
</style>
